package com.wei.flow;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class FlowMap extends Mapper<LongWritable, Text, FlowBean, Text>{

	@Override
	protected void map(LongWritable key, Text value,Context context)
			throws IOException, InterruptedException {
		String line = value.toString();
		String[] strings = line.split("\t");
		String upFlow=strings[strings.length-3];
		String downFlow=strings[strings.length-2];
		String phone=strings[1];
		FlowBean flowBean=new FlowBean(Long.parseLong(upFlow), Long.parseLong(downFlow));
		context.write(flowBean, new Text(phone));
	}
	
	

}
